#include <iostream>

using namespace std;

class Solution
{
public:
    int sqrt(int x)
	{
        // Start typing your C/C++ solution below
        // DO NOT write int main() function
		if(x<=0)
			return 0;
		if(x==1)
			return 1;

		int left = 1, right = x-1,mid;
		while(left<=right)
		{
			mid = left + (right-left)/2;
			int tsr = x/mid;
			if(tsr==mid)
				return mid;
			else if(tsr<mid)
				right = mid-1;
			else
				left = mid+1;
		}
		return right;        
    }
};

int main()
{
	int n;
	Solution s;
	while(cin>>n)
	{
		if(n<0)
			break;
		cout<<s.sqrt(n)<<endl;
	}
}